package es.uned.hoomgle.web.actions;
import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.convention.annotation.ResultPath;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;
import org.apache.struts2.views.tiles.TilesResult;
import com.opensymphony.xwork2.ActionSupport;

import es.uned.hoomgle.core.dtos.HomeDto;
import es.uned.hoomgle.core.dtos.UserDto;
import es.uned.hoomgle.core.services.interfaces.HomeServiceI;
import es.uned.hoomgle.core.services.interfaces.StateServiceI;
import es.uned.hoomgle.core.services.interfaces.UserServiceI;
import es.uned.hoomgle.hibernate.beans.impl.City;
import es.uned.hoomgle.hibernate.beans.impl.State;
import es.uned.hoomgle.hibernate.beans.impl.User;
import es.uned.hoomgle.hibernate.beans.interfaces.CityI;
import es.uned.hoomgle.hibernate.beans.interfaces.HomeI;
import es.uned.hoomgle.hibernate.beans.interfaces.StateI;
import es.uned.hoomgle.hibernate.beans.interfaces.UserI;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;


import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.springframework.security.core.context.SecurityContextHolder;



@ResultPath(value="/")
public class AdminAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
    private String [] permissionsChoice ; 
    private Set p_choices = new HashSet();
 
    
	@Resource
	private HomeServiceI homeService;
 
	@Resource
	private StateServiceI stateService;
	
	@Resource
	private UserServiceI userService;
	

	/**
	 * @return the permissionsChoice
	 */
	public String [] getPermissionsChoice() {
		return this.permissionsChoice;
	}

	/**
	 * @param permissionsChoice the p_choices to set
	 */
	public void setPermissionsChoice(String [] permissionsChoice){
		if (permissionsChoice != null && permissionsChoice.length>0){
			 for (int i = 0; i < permissionsChoice.length; i++) {
		            this.p_choices.add(permissionsChoice[i]);
		        }
		}
	   System.out.println("Choices: "+p_choices);
	}
		
	/**
	 * @return the string "permissions" to do action
	 */
	public String permissionsAdmin(){
		return "permissions";
	}
} 
	

